package com.aqie.rabbit.test;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Slf4j
public class ThreadPoolDemo {
    public static void main(String[] args) {
        ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 1000; i++) {
            final int index = i;
            fixedThreadPool.execute(new Runnable() {
                public void run() {
                    log.info("{}", index);
                    // Thread.sleep(2000);
                }
            });
        }
        fixedThreadPool.shutdown();
    }
}
